# import esp32c3
import lcd12864
from machine import Pin
from machine import Pin, I2C,ADC
import utime
import lc
# i2c = I2C(0,scl=Pin(5), sda=Pin(4),freq=400000)
# print(i2c.scan())
import machine
# esp32c3.tpe()
# lcd12864.lcdInit()
pin2 = Pin(3, Pin.OUT)
pin2.on()
pot = ADC(Pin(2))
pot.atten(ADC.ATTN_6DB) 
while 1:
    p_=[]
    for i in range(10):
        p_.append(pot.read())
        utime.sleep_ms(1)
    U_=lc.getvolt(p_)
    lcd12864.print8("%.2fV   "%(U_),80,4)
    utime.sleep_ms(500)
    print(pot.read())
    # print(p_*5.7/4096)
# R_=0
# T_=0
# U_=0
# lcd12864.st1(T_,R_,U_)
lcd12864.print8("%.2fV   "%(U_),80,4)
# machine.deepsleep(10000)